#include <REGX52.H>
#include "Delay.h"
#include "MatrixLED.h"
#include "Timer0.h"

unsigned char Offset=0;
unsigned char Animation[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//0x21,0x33,0x2A,0xA4,0x6A,0x33,0x21,0x20,
//0x00,0x20,0x21,0x33,0x2A,0xA4,0x6A,0x33,
//0x21,0x20,0x00,0x00,0x00,0xFF,0x01,0x01,
//0x0E,0x11,0x11,0x11,0x0E,0x01,0x00,0x0E,
//0x11,0x11,0x0E,0x00,0x00,0x00,0x32,0x49,
//0x49,0x49,0x2E,0x00,0x00,0x7F,0x10,0x10,
//0x1F,0x00,0x00,0x5F,0x00,0x00,0x00,0x00,
//0x00,0x00,0x00,0x00,	
0x48,0xE8,0x48,0x5F,0x48,0xEC,0x4C,0x00,
0x00,0xFF,0x89,0x89,0x89,0x89,0xFF,0x00,
0x00,0x04,0x18,0xFF,0x18,0x04,0x29,0x2A,
0xFC,0x2A,0x39,0x08,0x08,0x00,0x00,0x79,
0x4A,0x4D,0x7F,0xCC,0x8A,0x09,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,	
};

void main()
{
	unsigned char i;
	MatrixLED_Init();
	Timer0_Init();
	
	while(1)
	{
		for(i=0;i<8;i++)
		{
			MatrixLED_ShowColumn(i,Animation[i+Offset]);
		}
		
		
	}
	
}


void Timer0_Routine() interrupt 1  //定时器0的中断函数
{
	static unsigned int T0Count;//static静态局部变量，只有本函数能引用
	//退出函数不丢失T0Count变量
	
	TL0 = 0x18;		//设置定时初值
	TH0 = 0xFC;		//设置定时初值
	T0Count++;
	if(T0Count>=100)
	{
		Offset++;
		if(Offset>100)
			Offset=0;
		//清零重记次
		T0Count=0;
	}
	
}
